#include "Image.h"

Image::Image(int x, int y,std::string url){
	_x = x; 
	_y = y;
	_url = (char*)url.c_str();
	_scale = 1.0f;
	
	img = oslLoadImageFile(_url, OSL_IN_RAM, OSL_PF_8888);
	_scale = 200/img->stretchX;
	
	img->stretchX = 200;
	img->stretchY = 230;
	
	_height = img->stretchY+2;
	_width = img->stretchX+2;
}

void Image::draw(){
	UIComponent::draw();
	if(!img){
		oslSetFont(font);
  	oslDrawString(_x+5, _y+_height/2-10,"image is not avaliable");
	}else if(state == 0){
		oslDrawImageXY(img, _x+1, _y+1);
	}else if(state == 1){
		oslDrawImageXY(img, _x+1, _y+1);
	}else if(state == 2){
		oslDrawImageXY(img, _x+1, _y+1);
	}
}